﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DreamBuilder.Common;
using ePlanet.ArchiveMange.Services;
using ePlanet.ArchiveMange.Models;
using ePlanet.ArchiveMange.DataAccess;
using System.Data;

namespace ePlanet.ArchiveMange.Business
{
    public class BUSArchiveMenu : BusinessBase, IArchiveMenuService
    {
        ArchiveMenuDAL dal = new ArchiveMenuDAL();
        ArchiveCommon commonDal = new ArchiveCommon();
        public ArchiveMangeModal.ARCHIVEMENUDataTable GetAllArchiveMenu()
        {
            return dal.GetAllArchiveMenu();
        }

        public bool SaveArchiveMenuData(ArchiveMangeModal ds)
        {
            return dal.SaveArchiveMenu(ds);
        }

        
        public DataSet GetAttach(string ObjectID, string DBHelperString)
        {
            return commonDal.GetAttach(ObjectID, DBHelperString);
        }

        public ArchiveMangeModal.ARCHIVEMENUDataTable GetArchiveMenuById(string typeId)
        {
            return dal.GetArchiveMenuById(typeId);
        }

        /// <summary>
        /// 获取档案类型的基本类型ID
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public int GetArchiveBaseIDById(int Id)
        {
            return dal.GetArchiveBaseIDById(Id);
        }

        /// <summary>
        /// 获取用户有权限的编目
        /// </summary>
        /// <param name="list"></param>
        /// <returns></returns>
        public ArchiveMangeModal.ARCHIVEMENUDataTable GetUserArhiveMenu(IList<string> list)
        {
            return dal.GetUserArhiveMenu(list);
        }

        /// <summary>
        /// 获取所有的档案基本编目
        /// </summary>
        /// <returns></returns>
        public ArchiveMangeModal.ARCHIVEMENUDataTable GetAllBaseMenu()
        {
            return dal.GetAllBaseMenu();
        }

        #region IArchiveBase 成员
        public bool SaveAttach(DataTable dt_Attach, string objectTableName, string objectID, string DBHelperString)
        {
            return commonDal.SaveAttach(dt_Attach, objectTableName, objectID, DBHelperString);
        }


        public bool SaveData(DataSet ds)
        {
            return commonDal.SaveData(ds);
        }

        public bool DeleteData(string key)
        {
            return dal.DeleteData(key);
        }

        #endregion


        public bool IsSameSecret(List<Guid> dataIDList)
        {
            return dal.IsSameSecret(dataIDList);
        }

        public byte[] GetAttachContentByID(string dataID, string DBHelperString)
        {
            return this.commonDal.GetAttachContentByID(dataID, DBHelperString);
        }
    }
}
